home *** CD-ROM | disk | FTP | other *** search
- Path: kom22.ethz.ch!conrad
- From: conrad@kom22.ethz.ch (Christian Conrad)
- Newsgroups: comp.lang.c++
- Subject: Visible/Invisible Class definitions ?
- Date: 2 Feb 1996 12:42:24 GMT
- Organization: Swiss Federal Institute of Technology (ETHZ)
- Message-ID: <4et0rg$22d@elna.ethz.ch>
- NNTP-Posting-Host: kom22-e.ethz.ch
- X-Newsreader: TIN [version 1.2 PL1]
-
- Hello,
-
- I am quite new in the C++ programmation and I have now the following
- general question:
-
- I am building a library of approx. 3-4 base classes. Each class
- has a visible part (public) which must be used by the application
- programmer (the future user of the provided library) and a
- private/protected part which may be quite large.
-
- I would like to hide all the complexity and the internal details to
- the application programmer, and provide him only with the "public"
- part of the classes he needs. I did the following:
-
- class X_private {
-
- protected:
- // internal stuff, not relevant for the programmer
- };
-
- class X : private X_private {
-
- public:
-
- // relevant information for the programmer
- };
-
- I can separate these definitions in two distinct header files, by doing
- so, the programmer will still "see" the internal details by viewing the
- corresponding header file ! How to avoid this ? If everything is private,
- then the programmer cannot use it, so why should he see it ?
-
- This issue can be avoided in C by providing forward declarations, is there
- an equivalent mechanism in C++ ?
-
- Thanks for each answer.
-
- Christian Conrad
-
- --
-
- --------------------------- % % % % % ---------------------------
- %
- Christian CONRAD %
- % Tel. (+41) 1 / 632 7015
- ETH-Zurich % Fax (+41) 1 / 632 1035
- Technische Informatik und % E-Mail: conrad@tik.ee.ethz.ch
- Kommunikationsnetze (TIK) %
- %
- ---------------------------- % % % % % ---------------------------
-
-
-
-
-
-
-
-